const add = (...arr) => arr.reduce((pre, cur) => pre + cur, 0);

const curry = (fn,...args) => {
  let tmp = []
  const curried = (..._args) => {
    tmp = [...tmp, ..._args]
    return curried
  }
  curried.getRes = () => fn(...tmp)
  return curried(...args)
}

console.log(curry(add, 2)(3).getRes())
console.log(curry(add, 2, 3)(4).getRes())
console.log(curry(add, 1, 2, 3, 4)(5)(6, 7)(8)(9, 10).getRes())